<template>
    <div class="left-panel">
        <div>
            <div class="tab-container">
                <button class="tab-btn unselected">页面</button>
                <button class="tab-btn selected">组件</button>
            </div>
            <div>
                <div class="component-container">
                    <span class="selected">基础组件</span>
                    <span>拖拽使用</span>
                </div>
                <div>
                    <div class="component-item">
                        <div class="component-item-content">
                            <div class="icon"></div>
                            <span>热区个性图</span>
                            <p>0/300</p>
                        </div>
                        <div class="component-item-content" 
                        @click="handleClick"
                        >
                            <div class="icon"></div>
                            <span>热力文本</span>
                            <p>0/20</p>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="component-item">
                        <div class="component-item-content">
                            <div class="icon"></div>
                            <span>商品</span>
                            <p>0/100</p>
                        </div>
                        <div class="component-item-content">
                            <div class="icon"></div>
                            <span>图片广告</span>
                            <p>1/300</p>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="component-item">
                        <div class="component-item-content">
                            <div class="icon"></div>
                            <span>搜索</span>
                            <p>0/2</p>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="component-button">
                        <span >基础组件</span>
                    </div>
                    <div>
                         <div class="component-item">
                        <div class="component-item-content">
                            <div class="icon"></div>
                            <span>优惠卷</span>
                            <p>0/2</p>
                        </div>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>

import { defineEmits } from 'vue'

const emit = defineEmits(['add-text-block'])

const handleClick = () => {
  emit('add-text-block')
}
</script>
<style scoped>
.left-panel {
    margin: 0;
    padding: 0 5px;
    box-sizing: border-box;
}
.tab-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
}

/* 按钮基础样式 */
.tab-btn {
    padding: 8px 16px;
    border: none;
    cursor: default;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* 未选中按钮样式 */
.tab-btn.unselected {
    background-color: #f5f5f5;
    color: #333;
    border-radius: 20px 0 0 20px;
}

/* 选中按钮样式 */
.tab-btn.selected {
    background-color: #ff7a00;
    color: white;
    border-radius: 0 20px 20px 0;
}

.component-container {
    display: flex;
    padding: 12px 10px;
    align-items: center;
    font-size: 14px;
}

.component-container span {
    padding: 0 16px;
}

.component-container span.selected {
    color: #ff7a00;
    font-size: 16px;
}

.component-item {
    display: flex;
}

.component-item-content {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 12px 0;
}

.icon {
    width: 80px;
    height: 80px;
    background-color: #ccc;
}

.component-item-content span {
    margin: 5px 0 0 0;
}

.component-item-content p {
    margin: 5px 0 0 0;
    padding: 0;
    font-size: 16px;
    color: #666;
    text-align: center;
}

.component-button {
    padding:0 16px;
    margin-top: 30px;
}
</style>